package com.liuyan.util;


import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletResponse;
import java.io.*;

public class BaseController {
	
	private static Logger log = Logger.getLogger(BaseController.class);
	protected void writeJson(HttpServletResponse response,String content){
		response.setContentType("application/json;charset=UTF-8");
		PrintWriter out = null; 
		try {
			out = response.getWriter();
			out.print(content);
		} catch (IOException e) {			
			log.error(e.toString());
		}finally{
			out.close();  
		}
	}
	
	protected void writeText(HttpServletResponse response,String content){
		response.setContentType("text/html;charset=UTF-8");
		PrintWriter out = null; 
		try {
			out = response.getWriter();
			out.print(content);
		} catch (IOException e) {			
			log.error(e.toString());
		}finally{
			out.close();  
		}
	}
	

}
